#include <QtGui/QApplication>
#include <QtOpenGL>
#include <qdeclarative.h>

#include "qmlapplicationviewer.h"
#include "qparticles.h"

Q_DECL_EXPORT int main(int argc, char *argv[])
{
    // Depending on which is the recommended way for the platform, either use
    // opengl graphics system or paint into QGLWidget.
//#ifdef SHADEREFFECTS_USE_OPENGL_GRAPHICSSYSTEM
//        QApplication::setGraphicsSystem("opengl");
//#endif


    QScopedPointer<QApplication> app(createApplication(argc, argv));
    qmlRegisterType<QParticles>("Particles", 1, 0, "Particles");
    QmlApplicationViewer viewer;

//#ifndef SHADEREFFECTS_USE_OPENGL_GRAPHICSSYSTEM
    QGLFormat format = QGLFormat::defaultFormat();
    format.setSampleBuffers(false);
//    format.setSwapInterval(1);
    QGLWidget* glWidget = new QGLWidget(format);
    glWidget->setAutoFillBackground(false);
    viewer.setViewport(glWidget);
//#endif

//    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait);
//    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape);
    viewer.setMainQmlFile(QLatin1String("qml/sparticles/main.qml"));
    viewer.showExpanded();

    return app->exec();
}
